﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for PasswordManager
/// </summary>
public class PasswordManager
{
	public PasswordManager()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public string EncodePassword(string originalPassword)
    {
        //Declarations
        Byte[] originalBytes;
        Byte[] encodedBytes;
        System.Security.Cryptography.MD5 md5;
        //Instantiate MD5CryptoServiceProvider, get bytes for original password and compute hash (encoded password)
        md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
        originalBytes = System.Text.ASCIIEncoding.Default.GetBytes(originalPassword);
        encodedBytes = md5.ComputeHash(originalBytes);

        //Convert encoded bytes back to a 'readable' string
        return BitConverter.ToString(encodedBytes);
    }
}